﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyBanHang
{
    public partial class QLBH : Form
    {
        public QLBH()
        {
            InitializeComponent();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmAbout().ShowDialog();
        }

        private void hàngHóaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmHangHoa().ShowDialog();
        }

        private void hóaĐơnBánToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmHoaDonBan().ShowDialog();
        }

        private void hóaĐơnNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmHoaDonNhap().ShowDialog();
        }

        private void kháchHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmKhachHang().ShowDialog();
        }

        private void nhânViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmNhanVien().ShowDialog();
        }

        private void chấtLiệuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmChatLieu().ShowDialog();
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Bạn thực sự muốn thoát?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.No) return;

            Application.Exit();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime today = DateTime.Now;

            int hour = today.Hour;
            int min = today.Minute;
            int second = today.Second;
            lblClock.Text = "Thời gian: " + string.Format("{0}:{1}:{2}"
                                        , hour < 10 ? "0" + hour : hour + ""
                                        , min < 10 ? "0" + min : min + ""
                                        , second < 10 ? "0" + second : second + ""
                                    );
        }

        private void QLBH_Load(object sender, EventArgs e)
        {
            timer1.Interval = 1000;
            timer1.Start();
            
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Bạn thực sự muốn thoát?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.No)
                return;
            Application.Exit();
        }

        private void btnKhachHang_Click(object sender, EventArgs e)
        {
            new frmKhachHang().ShowDialog();
        }

        private void btnNhanVien_Click(object sender, EventArgs e)
        {
            new frmNhanVien().ShowDialog();
        }

        private void btnHoaDonNhap_Click(object sender, EventArgs e)
        {
            new frmHoaDonNhap().ShowDialog();
        }

        private void btnHoaDonBan_Click(object sender, EventArgs e)
        {
            new frmHoaDonBan().ShowDialog();
        }

        private void btnChatLieu_Click(object sender, EventArgs e)
        {
            new frmChatLieu().ShowDialog();
        }

        private void btnSanPham_Click(object sender, EventArgs e)
        {
            new frmHangHoa().ShowDialog();
        }

        private void danhSachSanPhâmTheoNhânViênBanVaKhachHangToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmBaoCaoSP().ShowDialog();
        }

        private void danhSáchHoáĐơnVàTổngTiềnNhậpHàngTheoNhaCungCâpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmBaoCaoDSHoaDon().ShowDialog();
        }

        private void danhSachCácHoáĐơnBánCủaMộtMặtHàngVàQuýĐượcChọnTrướcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmBaoCaoHDB().ShowDialog();
        }

        private void doanhThuCủaCửaHàngTheoNhânViênVàThángChọnTrướcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new frmDoanhThu().ShowDialog();
        }

    }
}
